home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3c / acctctl.z / acctctl
Encoding:
Text File  |  2002-10-03  |  9.1 KB  |  195 lines

  1.  
  2.  
  3.  
  4. aaaaccccccccttttccccttttllll((((3333cccc))))                                                        aaaaccccccccttttccccttttllll((((3333cccc))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      acctctl - controls and provides status for comprehensive system
  10.      accounting (CSA)
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////aaaacccccccctttt....hhhh>>>>
  14.  
  15.      iiiinnnntttt aaaaccccccccttttccccttttllll ((((iiiinnnntttt ffffuuuunnnnccccttttiiiioooonnnn,,,, vvvvooooiiiidddd ****aaaacccctttt))));;;;
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      The _aaaa_cccc_cccc_tttt_cccc_tttt_llll library call checks the status of, enables, and disables
  19.      process, daemon, and record accounting.  The record accounting types
  20.      supported are memory and  I/O.  The kernel and daemon accounting types
  21.      supported are csa, nqs, tape, and workload management. The _aaaa_cccc_cccc_tttt_cccc_tttt_llll
  22.      library call accepts the following arguments:
  23.  
  24.      _f_n_c    Identifies a function to be performed as follows:
  25.  
  26.             FFFFuuuunnnnccccttttiiiioooonnnn            DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  27.  
  28.             _AAAA_CCCC______SSSS_TTTT_AAAA_RRRR_TTTT            Starts kernel, daemon, or record accounting;
  29.                                 sets cpu time or memory threshold.
  30.  
  31.             _AAAA_CCCC______SSSS_TTTT_OOOO_PPPP             Stops kernel, daemon, or record accounting.
  32.  
  33.             _AAAA_CCCC______HHHH_AAAA_LLLL_TTTT             Stops all kernel, daemon, and record
  34.                                 accounting.
  35.  
  36.             _AAAA_CCCC______CCCC_HHHH_EEEE_CCCC_KKKK            Checks a kernel, daemon, or record accounting
  37.                                 state.
  38.  
  39.             _AAAA_CCCC______KKKK_DDDD_SSSS_TTTT_AAAA_TTTT           Checks all kernel and daemon accounting
  40.                                 states.
  41.  
  42.             _AAAA_CCCC______RRRR_CCCC_DDDD_SSSS_TTTT_AAAA_TTTT          Checks all record accounting states.
  43.  
  44.             _AAAA_CCCC______JJJJ_AAAA_SSSS_TTTT_AAAA_RRRR_TTTT          Starts user job accounting.
  45.  
  46.             _AAAA_CCCC______JJJJ_AAAA_SSSS_TTTT_OOOO_PPPP           Stops user job accounting.
  47.  
  48.             _AAAA_CCCC______WWWW_RRRR_AAAA_CCCC_CCCC_TTTT           Writes accounting record for a daemon program.
  49.  
  50.             _AAAA_CCCC______AAAA_UUUU_TTTT_HHHH             Checks if caller has the necessary
  51.                                 capabilities for privileged _aaaa_cccc_cccc_tttt_cccc_tttt_llll calls
  52.  
  53.      _a_c_t    Points to either an actctl, actstat, or actwra structure,
  54.             depending on the function (that is, _f_n_c) to be performed.  The
  55.             _aaaa_cccc_tttt_cccc_tttt_llll structure is used with _AAAA_CCCC______SSSS_TTTT_AAAA_RRRR_TTTT, _AAAA_CCCC______SSSS_TTTT_OOOO_PPPP, _AAAA_CCCC______KKKK_DDDD_SSSS_TTTT_AAAA_TTTT,
  56.             _AAAA_CCCC______RRRR_CCCC_DDDD_SSSS_TTTT_AAAA_TTTT, _AAAA_CCCC______JJJJ_AAAA_SSSS_TTTT_AAAA_RRRR_TTTT, and _AAAA_CCCC______JJJJ_AAAA_SSSS_TTTT_OOOO_PPPP functions.  The actstat
  57.             structure is used with _AAAA_CCCC______CCCC_HHHH_EEEE_CCCC_KKKK function.  The actwra structure is
  58.             used with the _AAAA_CCCC______WWWW_RRRR_AAAA_CCCC_CCCC_TTTT function.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaaccccccccttttccccttttllll((((3333cccc))))                                                        aaaaccccccccttttccccttttllll((((3333cccc))))
  71.  
  72.  
  73.  
  74.      This parameter is ignored for the _AAAA_CCCC______AAAA_UUUU_TTTT_HHHH function.
  75.  
  76.      The _AAAA_CCCC______SSSS_TTTT_AAAA_RRRR_TTTT, _AAAA_CCCC______SSSS_TTTT_OOOO_PPPP, _AAAA_CCCC______HHHH_AAAA_LLLL_TTTT, and _AAAA_CCCC______WWWW_RRRR_AAAA_CCCC_CCCC_TTTT functions require the
  77.      CAP_ACCT_MGT capability.  See the capability(4) and capabilities(4) man
  78.      pages for more information on the capability mechanism that provides fine
  79.      grained control over the privileges of a process.
  80.  
  81.      If the type of accounting you specified already is enabled and the path
  82.      information in the actctl structure differs from the accounting file
  83.      currently in use, the accounting file will be switched to the new path
  84.      without losing any accounting information.
  85.  
  86.      Only a process with appropriate privilege can use this system call to
  87.      enable or disable accounting.  However, privilege is not required to
  88.      check the status of accounting.
  89.  
  90. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  91.      The following example shows how to write an NQS daemon accounting record.
  92.      Similar code would be written for other daemon accounting record types.
  93.  
  94.      You need to use the following include statements:
  95.  
  96.           #include <sys/types.h>
  97.           #include <sys/time.h>
  98.           #include <sys/acct.h>
  99.           #include <csaacct.h>
  100.           #include <optional_sym.h>
  101.              ...
  102.  
  103.      To write a daemon accounting record within a procedure, see the following
  104.      example:
  105.  
  106.                   struct nqsbs nqsbs;
  107.                   struct actwra actwra;
  108.                   memset((char *)&nqsbs, 0, sizeof(nqsbs));
  109.                   nqsbs.hdr.ah_magic = ACCT_MAGIC;
  110.                   nqsbs.hdr.ah_revision = REV_NQS;
  111.                   nqsbs.hdr.ah_type = ACCT_DAEMON_NQS;
  112.                   nqsbs.hdr.ah_flag = 0;
  113.                   nqsbs.hdr.ah_size = sizeof(nqsbs);
  114.                   nqsbs.type = type;
  115.                   nqsbs.subtype = subtype;
  116.                   nqsbs.jid = jid;
  117.                   nqsbs.time = time(0);
  118.                   /* convert time values from clock ticks to microseconds */
  119.                   nqsbs.utime = clock_to_microsec(utime);
  120.                   nqsbs.stime = clock_to_microsec(stime);
  121.                   /* fill in remaining nqsbs fields */
  122.  
  123.  
  124.                                                                         PPPPaaaaggggeeee 2222
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. aaaaccccccccttttccccttttllll((((3333cccc))))                                                        aaaaccccccccttttccccttttllll((((3333cccc))))
  132.  
  133.  
  134.  
  135.                   actwra.ac_did = ACCT_DMD_NQS;
  136.                   actwra.ac_len = sizeof(nqsbs);
  137.                   actwra.ac_jid = jid;
  138.                   actwra.ac_buf = (char *)&nqsbs;
  139.                   if ( _MIPS_SYMBOL_PRESENT(acctctl) == 1) {
  140.                           if (acctctl(AC_WRACCT, &actwra)) {
  141.                                   /* handle error condition */
  142.                           }
  143.                   } else {
  144.                           /* this system doesn't have the acctctl() call available */
  145.                   }
  146.           }
  147.  
  148.  
  149. EEEERRRRRRRROOOORRRRSSSS
  150.      Under the following conditions, the _aaaa_cccc_cccc_tttt_cccc_tttt_llll function fails and sets _e_r_r_n_o
  151.      to:
  152.  
  153.      [EACCESS]      Search permission is denied on a component of the path
  154.                     prefix.
  155.  
  156.      [EFAULT]       The _a_c_t argument points to an illegal address.
  157.  
  158.      [EINVAL]       An invalid argument was specified.
  159.  
  160.      [EPERM]        The process does not have appropriate capability to use
  161.                     this library call.
  162.  
  163.      [ENOPKG]       The CSA software is not installed or not enabled via the
  164.                     _ssss_yyyy_ssss_tttt_uuuu_nnnn_eeee(1M) command.
  165.  
  166.      [ENOJOB]       No job table entry is found when attempting to start or
  167.                     stop user job accounting.
  168.  
  169. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  170.      Upon successful completion, _a_c_c_t_c_t_l returns a value of 0.  Otherwise, a
  171.      value of -1 is returned and eeeerrrrrrrrnnnnoooo is set to indicate the error.
  172.  
  173. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  174.      ja(1).
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.                                                                         PPPPaaaaggggeeee 3333
  191.  
  192.  
  193.  
  194.